Minor refactor of BL2 image load v2
authorDan Handley <[email protected]>
Tue, 18 Apr 2017 13:46:23 +0000 (14:46 +0100)
committerDan Handley <[email protected]>
Wed, 19 Apr 2017 17:05:41 +0000 (18:05 +0100)
Previously, get_next_bl_params_from_mem_params_desc() populated arg0
in the EL3 runtime entrypoint with a bl_params_t pointer. This is the
responsibility of the generic LOAD_IMAGE_V2 framework instead of the
descriptor-based image loading utility functions. Therefore this patch
moves that code to bl2_load_images().

Also, this patch moves the code that flushes the bl_params structure to
flush_bl_params_desc(), together with the other descriptor-based image
loading flushing code.

Change-Id: I4541e3f50e3878dde7cf89e9e8f31fe0b173fb9d
Signed-off-by: Dan Handley <[email protected]>
bl2/bl2_image_load_v2.c
common/desc_image_load.c

index 4fab6556304355b6ea1c2cf3ba98cbc7847515f8..05c0fcd27a6740e67813fc113654a3bd5d31c14e 100644 (file)
@@ -109,6 +109,10 @@ entry_point_info_t *bl2_load_images(void)
        assert(bl2_to_next_bl_params->head);
        assert(bl2_to_next_bl_params->h.type == PARAM_BL_PARAMS);
        assert(bl2_to_next_bl_params->h.version >= VERSION_2);
+       assert(bl2_to_next_bl_params->head->ep_info);
+
+       /* Populate arg0 for the next BL image */
+       bl2_to_next_bl_params->head->ep_info->args.arg0 = (u_register_t)bl2_to_next_bl_params;
 
        /* Flush the parameters to be passed to next image */
        plat_flush_next_bl_params();
index a9762b71704edc72882a14dae2abbfb86b9e82d6..52ef362b3cb2ed3a1d15f9c9d3c55c38ca48c33c 100644 (file)
@@ -47,8 +47,11 @@ static bl_params_t next_bl_params;
  ******************************************************************************/
 void flush_bl_params_desc(void)
 {
-       flush_dcache_range((unsigned long)bl_mem_params_desc_ptr,
+       flush_dcache_range((uintptr_t)bl_mem_params_desc_ptr,
                        sizeof(*bl_mem_params_desc_ptr) * bl_mem_params_desc_num);
+
+       flush_dcache_range((uintptr_t)&next_bl_params,
+                       sizeof(next_bl_params));
 }
 
 /*******************************************************************************
@@ -209,12 +212,5 @@ bl_params_t *get_next_bl_params_from_mem_params_desc(void)
        /* Invalid image is expected to terminate the loop */
        assert(img_id == INVALID_IMAGE_ID);
 
-       /* Populate arg0 for the next BL image */
-       next_bl_params.head->ep_info->args.arg0 = (unsigned long)&next_bl_params;
-
-       /* Flush the parameters to be passed to the next BL image */
-       flush_dcache_range((unsigned long)&next_bl_params,
-                       sizeof(next_bl_params));
-
        return &next_bl_params;
 }